package com.suxin.netty.client;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

import java.nio.charset.Charset;

/**
 * @author Tang
 * @classname MyClientSimpleChannelInboundHandler
 * @description [  ]
 * @date 2021/7/18 11:04
 */
public class MyClientSimpleChannelInboundHandler extends SimpleChannelInboundHandler<ByteBuf> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, ByteBuf byteBuf) throws Exception {
//        System.out.println("包的内容长度为:" + byteBuf.readInt());
        System.out.println("读取的内容为:" + byteBuf.toString(Charset.defaultCharset()));
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {

    }
}